//#define __DEBUG__
// by Xeno
#define THIS_FILE "x_revive\xr_f\fn_addactions.sqf"
#include "xr_macros.sqf"

private ["_unit", "_hasaction"];
_unit = _this;
_hasaction = __GV(_unit,GVARXR(ReviveAction));
if (isNil "_hasaction" || {_hasaction == -9999}) then {
	_reviveorcprs = if (GVARXR(pl_can_revive)) then {(localize "STR_DOM_MISSIONSTRING_923")} else {(localize "STR_DOM_MISSIONSTRING_924")};
	_reviveorcpr = "<t color='#FF0000'>" + _reviveorcprs + " " + name _unit + "</t>";
	_unit setVariable [QGVARXR(ReviveAction), _unit addAction [_reviveorcpr, {_this call FUNCXR(cdorevive)}, [], -1, false, false, "", "(_this distance _target <= 3) && {(_target getVariable 'xr_pluncon')} && {!(_this getVariable 'xr_pisinaction')} && {time > (_target getVariable 'xr_busyt')} && {!(_target getVariable 'xr_dragged')}"]];
	_unit setVariable [QGVARXR(DragAction), _unit addAction [format ["<t color='#FF0000'>Drag %1</t>", name _unit], {_this call FUNCXR(dodrag)}, [], -1, false, false, "", "(_this distance _target <= 3) && {(_target getVariable 'xr_pluncon')} && {!(_this getVariable 'xr_pisinaction')} && {time > (_target getVariable 'xr_busyt')} && {!(_target getVariable 'xr_dragged')}"]];
};